#include <stdio.h>
#include <stdlib.h>
#include "pac_object.h"

PacObject* pacObjectCreate(float posX, float posY) {
    PacObject *pacObject;

    // Allocation des ressources nécessaires à l'objet
    pacObject = (PacObject*) malloc(sizeof (PacObject));

    pacObject->initialPosX = posX;
    pacObject->initialPosY = posY;
    
    pacObject->currentDeplacementValue = -2;

    pacObject->currentMove = NO_MOVE;
    pacObject->nextMove = NO_MOVE;
    pacObject->lastMove = NO_MOVE;

    return pacObject;
}

void replaceObjectToInitialPosition(PacObject * aPacObject) {
    aPacObject->posX = aPacObject->initialPosX;
    aPacObject->posY = aPacObject->initialPosY;

    aPacObject->lastPosX = aPacObject->initialPosX;
    aPacObject->lastPosY = aPacObject->initialPosY;

    aPacObject->currentDeplacementValue = 0;
    
    aPacObject->currentMove = NO_MOVE;
    aPacObject->nextMove = NO_MOVE;
    aPacObject->lastMove = MOVE_UP;
}
